package com.wlyuan.open.scanner.repository.impl;

import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.wlyuan.open.scanner.config.ScannerProperties;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.Arrays;

/**
 * @author lijing
 * @description
 */
@Service
@Slf4j
@RequiredArgsConstructor
public class TenantCheckRepository {
    private final ScannerProperties scannerProperties;

    public boolean checkTenant(Long tenantId) {
        return StringUtils.isNotBlank(scannerProperties.getTenant()) &&
                Arrays.asList(scannerProperties.getTenant().split(",")).contains(String.valueOf(tenantId));
    }
}
